<%@include file="/WEB-INF/templates/configuration.jsp" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<style>

</style>
<h2>Chapters</h2>
<c:choose>
    <c:when test="${amountchapters != 0}">
        <!-- Wanneer er gebruikers opgeslagen zijn, worden ze hier getoond -->
        <table class="zebra">
            <tr>
                <td style="width:100px"> 
                    <strong>Chapter Title</strong>
                </td>
                <td style="width:300px">
                    <strong>Chapter Description</strong>
                </td>
                <td></td>
            </tr>
            <c:forEach var="tempChapter" items="${chapters}">
                <!-- Per gebruiker wordt nu een rij aangemaakt met daarin zijn gegevens -->
                <tr>
                    <td>
                        ${tempChapter.chapterName}
                    </td>
                    <td style="width:300px">
                        <div class="description">${tempChapter.chapterdescription}</div>
                    </td>
                    <td style="width:100px">
                        <a class="icon view" href="${url}chapter/view?chapterid=${tempChapter.chapterid}">view</a> 
                        <a class="icon edit" href="${url}chapter/edit?chapterid=${tempChapter.chapterid}">edit</a> 
                        <a class="icon delete" href="javascript:if(confirm('Weet u zeker dat u deze Chapter wil verwijderen?'))
                           window.location='${url}chapter/delete?chapterid=${tempChapter.chapterid}&courseid=${course.courseid}';">delete</a>
                    </td>
                </tr>
            </c:forEach>
        </table>
    </c:when>
    <c:otherwise>
        <!-- Als er geen cursussen zijn, wordt deze melding getoond -->
        There are no chapters found.
    </c:otherwise>
</c:choose>
<p>
    <a class="button" href="${url}chapter/new?courseid=${course.courseid}">Add a new chapter</a>
</p>
<p>
    <a class="button" href="${url}index">Back to index</a>
</p>